﻿using System;

namespace FilesTubeDAL
{
    /// <summary>
    /// Defines RapiShare Result object
    /// </summary>
    public class RsResult : IComparable, IEquatable<RsResult>
    {
        public string Name { get; set; }
        public string Extension { get; set; }
        public string Size { get; set; }
        public string Description { get; set; }
        public Uri Link { get; set; }
        public Uri DetailsLink { get; set; }
        public DateTime Added { get; set; }
        public string Password { get; set; }

        /// <summary>
        /// Implements IComparable
        /// </summary>
        /// <param name="obj">RSResult type object</param>
        /// <returns>1 = true, 0 = false</returns>
        public int CompareTo(object obj)
        {
            var o = (RsResult)obj;
            return o.Name == Name && o.Extension == Extension && o.Size == Size ? 1 : 0;
        }

        /// <summary>
        /// Implements IEquatable
        /// </summary>
        /// <param name="other">RSResult type object</param>
        /// <returns>true if equal, false if not</returns>
        public bool Equals(RsResult other)
        {
            return other.Name == Name && other.Extension == Extension && other.Size == Size;
        }
    }
}
